package com.qingke.java.service.command;

import java.util.HashMap;
import java.util.Map;

import com.qingke.java.service.commandimpl.ExitCommand;
import com.qingke.java.service.commandimpl.HelpCommand;
import com.qingke.java.service.commandimpl.ListCommand;
import com.qingke.java.service.commandimpl.LoginCommand;
import com.qingke.java.service.commandimpl.QuitCommand;
import com.qingke.java.service.commandimpl.SelectByCodeCommand;
import com.qingke.java.service.commandimpl.SelectByIdCommand;
import com.qingke.java.service.commandimpl.SelectByNameCommand;
public class SystemCommandFactory extends CommandFactory {
	private static Map<CommandCode, Command> cmdMap = new HashMap<CommandCode, Command>();

	static {
		//LOGIN, SELECTBYID, LIST, SELECTBYCODE, SELECTBYNAME, EXIT, QUIT,
		cmdMap.put(CommandCode.LOGIN, new LoginCommand());
		cmdMap.put(CommandCode.LIST, new ListCommand());
		cmdMap.put(CommandCode.SELECTBYID, new SelectByIdCommand());
		cmdMap.put(CommandCode.SELECTBYCODE, new SelectByCodeCommand());
		cmdMap.put(CommandCode.SELECTBYNAME, new SelectByNameCommand());
		cmdMap.put(CommandCode.EXIT, new ExitCommand());
		cmdMap.put(CommandCode.QUIT, new QuitCommand());
		cmdMap.put(CommandCode.HELP, new HelpCommand());
	}

	@Override
	public Command buildCommand(CommandCode cc) {
		return cmdMap.get(cc);
	}

}
